package com.fr.poker;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
*作者：furong
*日期：2017年3月16日
*时间：下午1:37:37
*/
public class Poker {
    static String color[] = { "红桃", "黑桃", "方块", "梅花" };
    static String value[] = { "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" };

    public static void main(String[] args) {
        String[] pokers = new String[52];
        for (int i = 0; i < 52; i++) {
            pokers[i] = color[i % 4] + value[i % 13];
        }
        // for (String s : pokers) {
        // System.out.print(s + "\t");
        // }
        for (int i = 51; i > 0; i--) {
            int random = (int) (Math.random() * i);
            String tmp = pokers[i];
            pokers[i] = pokers[random];
            pokers[random] = tmp;
        }
        // System.out.println();
        // for (String s : pokers) {
        // System.out.print(s + "\t");
        // }
        int n = 9;
        int point = 0;
        Map<Integer, List<String>> map = new HashMap<>();
        point++;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 2; j++) {
                List<String> tmp = map.get(i);
                if (tmp == null) {
                    tmp = new ArrayList<>();
                    tmp.add(pokers[point++]);
                    map.put(i, tmp);
                } else {
                    tmp.add(pokers[point++]);
                }
            }
        }
        for (int i = 0; i < n; i++) {
            System.out.println("玩家" + (i + 1) + "手牌:" + map.get(i));
        }
        System.out.println("Flop");
        point++;
        for (int i = 0; i < 3; i++) {
            System.out.print(pokers[point++] + "\t");
        }
        System.out.println();
        System.out.println("Turn");
        point++;
        System.out.print(pokers[point++] + "\t");
        System.out.println();
        System.out.println("River");
        point++;
        System.out.print(pokers[point++] + "\t");
    }
}
